using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Vote_Option - 投票表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleVoteOption<T> :ModelBase<ArticleVoteOption> where T : ArticleVoteOption, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.OptionId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return OptionId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.OptionId=dy.OptionId;
           this.ContentId=dy.ContentId;
           this.VoteId=dy.VoteId;
           this.OptionTxt=dy.OptionTxt;
           this.Votes=dy.Votes;
           this.IsMiscellaneous=dy.IsMiscellaneous;
        } 

        #region 定义属性

     
         /// <summary>
        /// 选项ID
        /// </summary>
        private String _OptionId = "";
      
        /// <summary>
        /// 选项ID
        /// </summary>
        public String OptionId
        {
            get 
            {
              return   (this._OptionId); 
            }

            set 
            {
                    _OptionId= value;  
            }
        }
       
     
         /// <summary>
        /// 内容ID
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// 内容ID
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 投票ID
        /// </summary>
        private String _VoteId = "";
      
        /// <summary>
        /// 投票ID
        /// </summary>
        public String VoteId
        {
            get 
            {
              return   (this._VoteId); 
            }

            set 
            {
                    _VoteId= value;  
            }
        }
       
     
         /// <summary>
        /// 选项名称
        /// </summary>
        private String _OptionTxt = "";
      
        /// <summary>
        /// 选项名称
        /// </summary>
        public String OptionTxt
        {
            get 
            {
              return   (this._OptionTxt); 
            }

            set 
            {
                    _OptionTxt= value;  
            }
        }
       
     
         /// <summary>
        /// 得票
        /// </summary>
        private int _Votes =int.MinValue;
      
        /// <summary>
        /// 得票
        /// </summary>
        public int Votes
        {
            get 
            {
              return   (this._Votes); 
            }

            set 
            {
                    _Votes= value;  
            }
        }
       
     
         /// <summary>
        /// 是否其他
        /// </summary>
        private int _IsMiscellaneous =int.MinValue;
      
        /// <summary>
        /// 是否其他
        /// </summary>
        public int IsMiscellaneous
        {
            get 
            {
              return   (this._IsMiscellaneous); 
            }

            set 
            {
                    _IsMiscellaneous= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleVoteOption info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["OptionId"]!= DBNull.Value)
                  {
                  info.OptionId=row["OptionId"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["VoteId"]!= DBNull.Value)
                  {
                  info.VoteId=row["VoteId"].ToString();
                 }
                 
                  
                  if(row["OptionTxt"]!= DBNull.Value)
                  {
                  info.OptionTxt=row["OptionTxt"].ToString();
                 }
                 
                  
                  if(row["Votes"]!= DBNull.Value)
                  {
                  info.Votes=Convert.ToInt32(row["Votes"]);
                 }
                 
                  
                  if(row["IsMiscellaneous"]!= DBNull.Value)
                  {
                  info.IsMiscellaneous=Convert.ToInt32(row["IsMiscellaneous"]);
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleVoteOption info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@OptionId", DbType.String,ParameterTool.GetObj( info._OptionId )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@VoteId", DbType.String,ParameterTool.GetObj( info._VoteId )); 
            
             
                cn.AddInParameter(comm, "@OptionTxt", DbType.String,ParameterTool.GetObj( info._OptionTxt )); 
            
             
                cn.AddInParameter(comm, "@Votes", DbType.Int32,ParameterTool.GetObj( info._Votes )); 
            
             
                cn.AddInParameter(comm, "@IsMiscellaneous", DbType.Int32,ParameterTool.GetObj( info._IsMiscellaneous )); 
            
        } 

    } 
} 